/*
 * Process.c
 * Author: Daniel Anderson
 * Base for process with code from Prof. Mobus
 */
#include "Simulator.h"
#include <stdlib.h>


void initializeProducerProcess(Process* c) {
	c->instructions = rand() % 5000 + 1000; //1000 to 5000 instructions
	c->request_at = rand() % c->instructions; //TODO this is funky
	c->request = SYS_SEM_UP;
	c->next_PC = 0;
	c->state = 1; //ready
	c->id = 1;
	//c->waiting_queue = null; //no initial waiting queue
}

void initializeConsumerProcess(Process* c) {
	c->instructions = rand() % 5000 + 1000; //1000 to 5000 instructions
	c->request_at = rand() % c->instructions;
	c->request = SYS_SEM_DOWN;
	c->next_PC = 0;
	c->state = 1; //ready
	c->id = 2;
	//c->waiting_queue = null; //no initial waiting queue

}

void initializeCalculatorProcess(Process* c) {
	c->instructions = rand() % 5000 + 1000; //1000 to 5000 instructions
	c->request_at = rand() % c->instructions;
	c->request = SYS_MEM_RW;
	c->next_PC = 0;
	c->state = 1; //ready
	c->id = 3;
	//c->waiting_queue = null; //no initial waiting queue

}

void initializeKeyboardProcess(Process* c) {
	c->instructions = rand() % 5000 + 1000; //1000 to 5000 instructions
	c->request_at = rand() % c->instructions;
	c->request = SYS_IO;
	c->next_PC = 0;
	c->state = 1; //ready
	c->id = 4;
	//c->waiting_queue = null; //no initial waiting queue
}
